home *** CD-ROM | disk | FTP | other *** search
/ Delphi Developer's Kit 1996 / Delphi Developer's Kit 1996.iso / power / tform1 / rootform.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-12-22  |  2.1 KB  |  69 lines

  1. unit Rootform;
  2. (*--------------------------------------------------------------------*)
  3. (*      MAMAVISION Software Consult                                   *)
  4. (*--------------------------------------------------------------------*)
  5. (*      'Root' Formclass which covers functionality for all derived   *)
  6. (*      'Data' Forms.                                                 *)
  7. (*      When IDE supports form inheritance the method LoadRes will    *)
  8. (*      be cleared and the file rootform.dfm must no longer be provided*)
  9. (*--------------------------------------------------------------------*)
  10. (*      Subclassing:                                                  *)
  11. (*          TForm --> TForm0                                              *)
  12. (**********************************************************************)
  13. interface
  14.  
  15. uses
  16.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  17.   Forms, Dialogs, Buttons, ExtCtrls;
  18.  
  19. type
  20.   TForm0 = class(TForm)
  21.     StatusBar: TPanel;
  22.     SpeedPanel: TPanel;
  23.     OpenBtn: TSpeedButton;
  24.     SaveBtn: TSpeedButton;
  25.     ExitBtn: TSpeedButton;
  26.     NextBtn: TSpeedButton;
  27.     procedure ExitBtnClick(Sender: TObject);
  28.     procedure NextBtnClick(Sender: TObject);
  29.   private
  30.     { Private-Deklarationen }
  31.   protected
  32.     { Protected-Deklarationen }
  33.     ResLoaded:boolean;
  34.     procedure LoadRes;
  35.   public
  36.     { Public-Deklarationen }
  37.   end;
  38.  
  39. implementation
  40.  
  41. {$R *.DFM}
  42.  
  43. procedure TForm0.LoadRes;
  44. var tempCaption:string;
  45.     component_dummy:tcomponent;
  46. begin
  47.   if Resloaded then exit;
  48.   tempCaption := caption;  { Save Props of derived Form }
  49.   try  { at runtime : read from current dir or custom path...}
  50.     component_dummy := ReadComponentResFile('RootForm.dfm', Self);
  51.   except { debugging : read from special dir }
  52.     component_dummy := ReadComponentResFile('e:\RootForm.dfm', Self);
  53.   end;
  54.   Caption := tempCaption;  { Restore Props of derived Form  }
  55.   Resloaded := component_dummy <> nil;
  56. end;
  57.  
  58. procedure TForm0.ExitBtnClick(Sender: TObject);
  59. begin
  60.   Close;
  61. end;
  62.  
  63. procedure TForm0.NextBtnClick(Sender: TObject);
  64. begin
  65.   messagebeep(10);
  66. end;
  67.  
  68. end.
  69.